<%@ page import="com.cisite.manager.Manager" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'manager.label', default: '增加管理员')}" />
        <g:set var="male" value="${message(code: 'manager.sex.male.label', default: '男')}"/>
        <g:set var="female" value="${message(code: 'manager.sex.female.label', default: '女')}"/>
		<title><g:message code="default.create.label" args="[entityName]" /></title>
	</head>
	<body>
		<div id="create-manager" class="content scaffold-create" role="main">
			<g:if test="${flash.message}">
			   <div class="message" role="status">${flash.message}</div>
			</g:if>
			<g:hasErrors bean="${managerInstance}">
			<ul class="errors" role="alert">
				<g:eachError bean="${managerInstance}" var="error">
				   <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
				</g:eachError>
			</ul>
			</g:hasErrors>
			<g:form action="save" >
				<fieldset class="form">
				     <div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'userName', 'error')} ">
						<label for="userName">
							<g:message code="manager.userName.label" default="登录名" />
						    <span class="required-indicator">*</span>
						</label>
						<g:textField name="userName" value="${managerInstance?.userName}"/>
					 </div>

					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'realName', 'error')} ">
						<label for="realName">
							<g:message code="manager.realName.label" default="姓名" />
						    <span class="required-indicator">*</span>
						</label>
						<g:textField name="realName" value="${managerInstance?.realName}"/>
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'password', 'error')} ">
						<label for="password">
							<g:message code="manager.password.label" default="密码" />
						    <span class="required-indicator">*</span>
						</label>
						<g:textField name="password" value="${managerInstance?.password}"/>
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'passwordAgain', 'error')} ">
						<label for="passwordAgain">
							<g:message code="manager.passwordAgain.label" default="确认密码" />
						    <span class="required-indicator">*</span>
						</label>
						<g:textField name="passwordAgain"/>
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'sex', 'error')} required">
						<label for="sex">
							<g:message code="manager.sex.label" default="性别" />
							<span class="required-indicator">*</span>
						</label>
					    <g:select name="sex" optionKey="sex" optionValue="queryShow"
					       from="${[[sex:'1',queryShow:"${male}"],[sex:'2',queryShow:"${female}"]]}"  value="${fieldValue(bean: managerInstance, field: 'sex')}" >
					    </g:select>  
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'email', 'error')} ">
						<label for="email">
							<g:message code="manager.email.label" default="Email" />
						</label>
						<g:textField name="email" value="${managerInstance?.email}"/>
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'qq', 'error')} ">
						<label for="qq">
							<g:message code="manager.qq.label" default="qq" />
						</label>
						<g:textField name="qq" value="${managerInstance?.qq}"/>
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'birthday', 'error')} ">
						<label for="birthday">
							<g:message code="manager.birthday.label" default="生日" />
							<span class="required-indicator">*</span>
						</label>
						<g:datePicker name="birthday" precision="day"  value="${managerInstance?.birthday}"  />
					</div>
					
					<div class="fieldcontain ${hasErrors(bean: managerInstance, field: 'introduce', 'error')} ">
						<label for="introduce">
							<g:message code="manager.introduce.label" default="自我介绍" />
						</label>
						<g:textArea name="introduce" value="${managerInstance?.introduce}"/>
					</div>
					<g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: '提交')}" />
				</fieldset>
			</g:form>
		</div>
	</body>
</html>
